package bos.web.action;

import java.io.IOException;
import java.util.List;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import bos.domain.Function;
import bos.web.action.base.BaseAction;


@Controller
@Scope("prototype")
public class FunctionAction extends BaseAction<Function>{

		public String listajax() throws IOException{
		List<Function> list=functionService.findAll();
		String[] excludes=new String[]{"function","functions","roles"};
		this.writeList2Json(list, excludes);
		return NONE;
		
	}
	public String pageQuery() throws IOException{
	String page=model.getPage();
	pageBean.setCurrentPage((Integer.parseInt(page)));
	functionService.pageQuery(pageBean);
	String[] excludes=new String[]{"function","functions","roles","currentPage","detachedCriteria","pageSize"};
	this.writePageBean2Json(pageBean, excludes);
	return NONE;
	
}

	public String add(){
		functionService.save(model);
		return "list";
	}
	
public String findMenu() throws IOException{
	List<Function> list=functionService.findMenu();
	String[] excludes=new String[]{"functions","function","roles"};
	this.writeList2Json(list, excludes);
	
	return NONE;
	
	
}
}
